package com.ruyuan.payment.pay.controller;

import com.ruyuan.payment.server.req.OrderPayAddReq;
import com.ruyuan.payment.server.resp.CommonResp;
import com.ruyuan.payment.server.service.OrderPayService;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

@RestController
@RequestMapping("/order-pay")
public class OrderPayController {

    @Resource
    private OrderPayService orderPayService;

    @PostMapping("/pay")
    public CommonResp pay(@RequestBody OrderPayAddReq req) {
        String body = orderPayService.pay(req);
        CommonResp<String> commonResp = new CommonResp<>();
        commonResp.setContent(body);
        return commonResp;
    }
}
